package com.gexin.service.product;

/*import com.gexin.common.model.ApiResponse;
import com.gexin.model.product.Category;
import com.gexin.model.product.Product;
import com.jfinal.plugin.activerecord.Page;

import java.util.Date;
import java.util.List;*/

public class CategoryService {
	public static final CategoryService dao = new CategoryService();

	/*public ApiResponse save(Category category) {
		if(category==null){

			return new ApiResponse(false,"数据不能为null!");
		}
		boolean returnboo = false;
		if(category.getId()==null){
			Category byName = Category.dao.findByName(category.getCategoryName());
			if(byName!=null){
				return new ApiResponse(false,"分类名称已经存在!请不要重复添加!");
			}
			category.setCreateTime(new Date());
			returnboo = category.save();
		}else{
			returnboo = category.update();
		}
		return new ApiResponse(returnboo,returnboo?"保存成功!":"保存失败!");
	}

	*//**
	 * 获取分类的分页信息
	 * @param page
	 * @param pageSize
	 *//*
	public Page<Category> findList(int page , int pageSize) {
		Page<Category> list = Category.dao.findList(page , pageSize);
		return list;

	}

	public ApiResponse deleteById(String id) {
		List<Product> products = Product.dao.findByCategoryId(id);
		if(products!=null&&products.size()!=0){
			return new ApiResponse(false,"该分类下存在商品!不能删除改分类!");
		}
		boolean delete = Category.dao.deleteById(id);
		return new ApiResponse(delete,delete?"删除成功!":"删除失败!");
	}*/
}
